package com.siam.package_rider.controller.rider;

import com.siam.package_common.entity.BasicResult;
import com.siam.package_rider.cache.RiderSessionManager;
import com.siam.package_rider.entity.TbRider;
import com.siam.package_rider.model.param.TbRiderBillParam;
import com.siam.package_rider.service.TbRiderBillService;
import com.siam.package_user.model.param.MemberWithdrawRecordParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * ---------------------------
 * 骑手账单表 (TbRiderBillController)         
 * ---------------------------
 * 作者：  高品
 * 时间：  2025-03-29 18:55:18
 * ---------------------------
 */
@RestController
@RequestMapping("/rest/rider/bill")
public class TbRiderBillController {

	@Autowired
	private TbRiderBillService tbRiderBillService;

	@Autowired
	private RiderSessionManager riderSessionManager;

    /**
     * 基础分页查询
     * @param param
     * @return
     */
	@PostMapping(value="/page")
	public BasicResult page(@RequestBody TbRiderBillParam param) {
		TbRider loginRider = riderSessionManager.getSession(com.siam.package_user.util.TokenUtil.getToken());
		param.setRiderId(loginRider.getId());
		return BasicResult.success(tbRiderBillService.page(param));
	}

    /**
     * 根据主键查询
     * @param id
     * @return
     */
	@PostMapping(value="/findById")
	public BasicResult findById(@RequestParam Long id) {
		return BasicResult.success(tbRiderBillService.findById(id));
	}
}